package com.naiterui.ehp.bs.esign.controller.inner;

import com.naiterui.ehp.bp.bo.groupConsult.GroupConsultPreSignBO;
import com.naiterui.ehp.bp.bo.groupConsult.GroupConsultPreSignParamBO;
import com.naiterui.ehp.bp.bo.groupConsult.GroupConsultSignParamBO;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.esign.service.IGroupConsultService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gaoliangliang
 * @date 2022/8/3
 * @since 0.0.1
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("esign/inner/groupconsult")
public class EsignInnerGroupConsultController {

    private final IGroupConsultService groupConsultService;

    /**
     * 会诊意见预签署
     *
     * @param groupConsultPreSignParamBO
     * @return
     * @throws BusinessException
     */
    @PostMapping("presign")
    public GroupConsultPreSignBO presign(@RequestBody GroupConsultPreSignParamBO groupConsultPreSignParamBO) throws BusinessException {
        log.info("获取会诊意见单unionId开始 groupConsultSignBO:{}", groupConsultPreSignParamBO);
        GroupConsultPreSignBO bo = groupConsultService.preSign(groupConsultPreSignParamBO);
        log.info("获取会诊意见单unionId成功 signBO:{}=", bo);
        return bo;
    }

    /**
     * 会诊意见签署
     *
     * @param groupConsultSignBO
     * @throws BusinessException
     */
    @PostMapping("sign")
    public void sign(@RequestBody GroupConsultSignParamBO groupConsultSignBO) throws BusinessException {
        log.info("会诊意见单签名开始 groupConsultSignBO:{}", groupConsultSignBO);
        groupConsultService.sign(groupConsultSignBO);
    }

}
